
var userInfoApp = angular.module("userInfoApp",["scService"]);
userInfoApp.controller("userInfoController",function($scope,$rootScope,$location,commonService,jsonToStr){
	//退出登录
	$scope.userInfoPhone = localStorage.getItem("phone").replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
	var userId = localStorage.getItem("userId");
	var token = localStorage.getItem("token");
	var account = localStorage.getItem("account");
	$scope.outClick = false;
	$scope.logOut = function(){
		
		$scope.setConfirmEx()
		
	};
	//确定退出
	$rootScope.sureLogOut = function(){
		$scope.outClick = true;
		$scope.confirmExHide();
		var postData ={
			"source":"124",
			// "userId":userId,
			// "token":token,
			"account":userId,
			"jPushRegId":account,
			"merchantCode":"0201610047"
		};
		commonService.commonAjaxByPost("/user/unlockUser",postData)
		.then(function(data){
			// alert(JSON.stringify(data));
			if(data.code=="200"){
				 localStorage.clear();
				// $location.path("/login/1")
				window.location.href="http://" + window.location.host + "/appserver/static/wechat-ht/enter.html?state=1"
			}else{
				$scope.outClick = false;
			}
		});
	};
});
